package com.lzh.financial.util;

import org.springframework.context.ApplicationContext;

public class MapperFactory {

    private static ApplicationContext applicationContext;

    private static volatile MapperFactory mInstance;

    public MapperFactory(){
    }

    /**
     * 生成单例对象
     * @return
     */
    public static MapperFactory instance(){
        if (mInstance==null){
            synchronized (MapperFactory.class){
                if (mInstance==null) {
                    mInstance = new MapperFactory();
                }
            }
        }
        return mInstance;
    }



    public  <T> T createMapper(Class<T> clz) {
        T result = null;
        try {
            result = (T) Class.forName(clz.getName()).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }


}
